﻿Imports Base

Public Class InterfaceManager

#Region "TablesSingle"

    Private Shared Sub TablesSingleInsert(ByVal tableType As Data.TableSingleType, ByRef inCbo As SuperComboBox)
        Try
            Dim oTableSingleInfo As New Data.TableSingleInfo
            oTableSingleInfo.intType = tableType

            Dim ofrmTableSingleInsertion As New frmTableSingleInsert
            If ofrmTableSingleInsertion.Initialize(oTableSingleInfo) Then
                If ofrmTableSingleInsertion.ShowDialog = vbOK Then
                    inCbo.Ricarica(ofrmTableSingleInsertion.mId)
                End If
            End If
            ofrmTableSingleInsertion = Nothing
        Catch ex As Exception
            Base.ShowError.Show("Insert", "InterfaceManager", inCbo.Name, ex)
        End Try
    End Sub

    Private Shared Sub TablesSingleModify(ByVal tableType As Data.TableSingleType, ByRef inCbo As SuperComboBox, ByVal intID As Integer)
        Try
            Dim oTableSingleInfo As New Data.TableSingleInfo
            oTableSingleInfo.intType = tableType

            Dim ofrmTableSingleModify As New frmTableSingleModify
            If ofrmTableSingleModify.Initialize(intID, oTableSingleInfo) Then
                If ofrmTableSingleModify.ShowDialog = vbOK Then
                    inCbo.Ricarica(intID)
                End If
            End If
            ofrmTableSingleModify = Nothing
        Catch ex As Exception
            Base.ShowError.Show("Modify", "InterfaceManager", inCbo.Name, ex)
        End Try
    End Sub

    Public Shared Sub Topics_OnInsert(ByRef inCbo As SuperComboBox)
        Call TablesSingleInsert(Data.TableSingleType.TOPICS, inCbo)
    End Sub

    Public Shared Sub Topics_OnModify(ByRef inCbo As SuperComboBox, ByVal intID As Integer)
        Call TablesSingleModify(Data.TableSingleType.TOPICS, inCbo, intID)
    End Sub

    Public Shared Sub Backlogs_OnInsert(ByRef inCbo As SuperComboBox)
        Call TablesSingleInsert(Data.TableSingleType.BACKLOGS, inCbo)
    End Sub

    Public Shared Sub Backlogs_OnModify(ByRef inCbo As SuperComboBox, ByVal intID As Integer)
        Call TablesSingleModify(Data.TableSingleType.BACKLOGS, inCbo, intID)
    End Sub

    Public Shared Sub Activities_OnInsert(ByRef inCbo As SuperComboBox)
        Call TablesSingleInsert(Data.TableSingleType.ACTIVITIES, inCbo)
    End Sub

    Public Shared Sub Activities_OnModify(ByRef inCbo As SuperComboBox, ByVal intID As Integer)
        Call TablesSingleModify(Data.TableSingleType.ACTIVITIES, inCbo, intID)
    End Sub

#End Region

#Region "Meetings"

    Public Shared Sub Meetings_OnInsert(ByRef inCbo As SuperComboBox)
        Try
            Dim oFrm As New frmMeetingsInsert
            If oFrm.Initialize() Then
                If oFrm.ShowDialog = vbOK Then
                    inCbo.Ricarica(oFrm.mId)
                End If
            End If
            oFrm = Nothing
        Catch ex As Exception
            Base.ShowError.Show("Insert", "InterfaceManager", inCbo.Name, ex)
        End Try
    End Sub

    Public Shared Sub Meetings_OnModify(ByRef inCbo As SuperComboBox, ByVal intID As Integer)
        Try
            Dim oFrm As New frmMeetingsModify
            If oFrm.Initialize(intID) Then
                If oFrm.ShowDialog = vbOK Then
                    inCbo.Ricarica(intID)
                End If
            End If
            oFrm = Nothing
        Catch ex As Exception
            Base.ShowError.Show("Modify", "InterfaceManager", inCbo.Name, ex)
        End Try
    End Sub

#End Region

#Region "UserStories"

    Public Shared Sub UserStories_OnInsert(ByRef inCbo As SuperComboBox)
        Try
            Dim oFrm As New frmUserStoriesInsert
            If oFrm.Initialize() Then
                If oFrm.ShowDialog = vbOK Then
                    inCbo.Ricarica(oFrm.mId)
                End If
            End If
            oFrm = Nothing
        Catch ex As Exception
            Base.ShowError.Show("Insert", "InterfaceManager", inCbo.Name, ex)
        End Try
    End Sub

    Public Shared Sub UserStories_OnModify(ByRef inCbo As SuperComboBox, ByVal intID As Integer)
        Try
            Dim oFrm As New frmUserStoriesModify
            If oFrm.Initialize(intID) Then
                If oFrm.ShowDialog = vbOK Then
                    inCbo.Ricarica(intID)
                End If
            End If
            oFrm = Nothing
        Catch ex As Exception
            Base.ShowError.Show("Modify", "InterfaceManager", inCbo.Name, ex)
        End Try
    End Sub


#End Region

#Region "Sprints"

    Public Shared Sub Sprints_OnInsert(ByRef inCbo As SuperComboBox)
        Try
            Dim oFrm As New frmSprintsInsert
            If oFrm.Initialize() Then
                If oFrm.ShowDialog = vbOK Then
                    inCbo.Ricarica(oFrm.mId)
                End If
            End If
            oFrm = Nothing
        Catch ex As Exception
            Base.ShowError.Show("Insert", "InterfaceManager", inCbo.Name, ex)
        End Try
    End Sub

    Public Shared Sub Sprints_OnModify(ByRef inCbo As SuperComboBox, ByVal intID As Integer)
        Try
            Dim oFrm As New frmSprintsModify
            If oFrm.Initialize(intID) Then
                If oFrm.ShowDialog = vbOK Then
                    inCbo.Ricarica(intID)
                End If
            End If
            oFrm = Nothing
        Catch ex As Exception
            Base.ShowError.Show("Modify", "InterfaceManager", inCbo.Name, ex)
        End Try
    End Sub

#End Region

#Region "Projects"

    Public Shared Sub Projects_OnInsert(ByRef inCbo As SuperComboBox)
        Try
            Dim oFrm As New frmProjectsInsert
            If oFrm.Initialize() Then
                If oFrm.ShowDialog = vbOK Then
                    inCbo.Ricarica(oFrm.mId)
                End If
            End If
            oFrm = Nothing
        Catch ex As Exception
            Base.ShowError.Show("Insert", "InterfaceManager", inCbo.Name, ex)
        End Try
    End Sub

    Public Shared Sub Projects_OnModify(ByRef inCbo As SuperComboBox, ByVal intID As Integer)
        Try
            Dim oFrm As New frmProjectsModify
            If oFrm.Initialize(intID) Then
                If oFrm.ShowDialog = vbOK Then
                    inCbo.Ricarica(intID)
                End If
            End If
            oFrm = Nothing
        Catch ex As Exception
            Base.ShowError.Show("Modify", "InterfaceManager", inCbo.Name, ex)
        End Try
    End Sub

#End Region

End Class
